package com.umer.pinban.user.dialog;

import android.content.Context;
import android.view.View;
import android.widget.LinearLayout;
import androidx.annotation.NonNull;
import com.common.utils.screen.ScreenUtil;
import com.lxj.xpopup.animator.PopupAnimator;
import com.lxj.xpopup.core.BottomPopupView;
import com.umer.pinban.R;
import org.greenrobot.eventbus.EventBus;

/**
 * 选择书架
 */
public class DialogXieYi extends BottomPopupView {

    private EventBus eventBus;
    private Context context;
    private LinearLayout linear_ok_xieyi;

    public DialogXieYi(@NonNull Context context) {
        super(context);
        this.context = context;
    }

    // 返回自定义弹窗的布局
    @Override
    protected int getImplLayoutId() {
        return R.layout.dialog_xie_yi;
    }
    // 执行初始化操作，比如：findView，设置点击，或者任何你弹窗内的业务逻辑
    @Override
    protected void onCreate() {
        super.onCreate();
        linear_ok_xieyi = findViewById(R.id.linear_ok_xieyi);
        linear_ok_xieyi.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
            }
        });
    }
    // 设置最大宽度，看需要而定
    @Override
    protected int getMaxWidth() {
        return ScreenUtil.getInstance().getScreenWidth();
    }
    // 设置最大高度，看需要而定
    @Override
    protected int getMaxHeight() {
        return super.getMaxHeight();
    }
    // 设置自定义动画器，看需要而定
    @Override
    protected PopupAnimator getPopupAnimator() {
        return super.getPopupAnimator();
    }
    /**
     * 弹窗的宽度，用来动态设定当前弹窗的宽度，受getMaxWidth()限制
     *
     * @return
     */
    protected int getPopupWidth() {
        return ScreenUtil.getInstance().getScreenWidth();
    }

    /**
     * 弹窗的高度，用来动态设定当前弹窗的高度，受getMaxHeight()限制
     *
     * @return
     */
    protected int getPopupHeight() {
        return 0;
    }

    public void setEventBus(EventBus eventBus) {
        this.eventBus = eventBus;
    }
}